package com.qlk.odcinterface.dao.impl;

import com.qlk.common.dao.mybatis.BaseDao;
import com.qlk.odcinterface.dao.PmsCouponDao;
import com.qlk.odcinterface.domain.PmsCoupon;
import com.qlk.odcinterface.domain.query.PmsCouponQuery;

import java.util.List;
import org.springframework.stereotype.Repository;

/**
 * PmsCouponDAO实现类<br/>
 * 对'优惠券'表进行基本的操作
 * 
 * @author zhaoyanan
 * @version 2016-4-14 14:11:36
 * 
 */
@Repository
public class PmsCouponDaoImpl extends BaseDao implements PmsCouponDao {
    /** namespace */
    private final String namespace = PmsCouponDaoImpl.class.getName();
    
    /**
     * {@inheritDoc}
     */
    public List<PmsCoupon> queryPmsCouponList(PmsCouponQuery queryBean) {
        return (List<PmsCoupon>) queryForList(namespace +".queryPmsCouponList", queryBean);
    }

    /**
     * {@inheritDoc}
     */
    public boolean insert(PmsCoupon pmsCoupon) {
        return insert(namespace +".insert", pmsCoupon);
    }

    /**
     * {@inheritDoc}
     */
    public boolean update(PmsCoupon pmsCoupon) {
        return update(namespace +".update", pmsCoupon);
    }

    /**
     * {@inheritDoc}
     */
    public int queryPmsCouponCount(PmsCouponQuery queryBean) {
        return (Integer) queryForObject(namespace +".queryPmsCouponCount", queryBean);
    }

    /**
     * {@inheritDoc}
     */
    public List<PmsCoupon> queryPmsCouponListWithPage(PmsCouponQuery queryBean) {
        return (List<PmsCoupon>) queryForList(namespace +".queryPmsCouponListWithPage", queryBean);
    }

    /**
     * {@inheritDoc}
     */
    public boolean delete(PmsCoupon configuration) {
        return delete(namespace +".delete", configuration);
    }

    /**
     * {@inheritDoc}
     */
    public PmsCoupon getPmsCouponById(Long id) {
        return (PmsCoupon) queryForObject(namespace +".getPmsCouponById", id);
    } 
    
    /**
     * {@inheritDoc}
     */
    public boolean exist(PmsCoupon pmsCoupon) {
        int count = (Integer) queryForObject(namespace +".exist", pmsCoupon);
        return count > 0;
    }

	public boolean updatePmsCouponStatus(PmsCoupon pmsCoupon) {
		return update(namespace +".updateStatus", pmsCoupon);
	}

	@Override
	public boolean updateDeleteAt(PmsCoupon pmsCoupon) {
		
		return update(namespace +".updateDeleteAt",pmsCoupon);
	}
}
